package com.allenyuan.renderobject;

import com.allenyuan.render.Renderer;

public abstract class RenderObject {
	
	public static final int RENDER_SHAPE = 0;
	public static final int RENDER_IMAGE = 1;
	public static final int RENDER_TEXT = 2;
	public static final int RENDER_RECTANGLE = 3;
	public static final int RENDER_CIRCLE = 4;
	public static final int RENDER_POINT = 5;
	public static final int RENDER_LINE = 6;
	public static final int RENDER_PATH = 7;
	public static final int RENDER_PATH_ELEMENT = 8;
	
	public static final int MOUSE_PRESS = 0;
	public static final int MOUSE_RELEASE = 1;
	public static final int MOUSE_CLICK = 2;
	public static final int MOUSE_DRAG = 3;
	public static final int MOUSE_MOVE = 4;
	
	private int type;
	
	private boolean isSelected = false;
	
	public RenderObject(int type) {
		this.type = type;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}
	
	public RenderRectangle getBound() {
		return null;
	}

	public abstract void draw(Renderer r);

	public boolean isSelected() {
		return isSelected;
	}

	public void setSelected(boolean isSelected) {
		this.isSelected = isSelected;
	}

	public boolean contains(RenderPoint point) {
		return false;
	}
	
	public void move(int x, int y) {
		
	}
	
	public void drawProgress(int mouse, RenderPoint point) {
		
	}
	
	public static RenderObject create(int type) {
		switch (type) {
		case RENDER_LINE:
			return new RenderLine();
		case RENDER_CIRCLE:
			return new RenderCircle();
		case RENDER_IMAGE:
			return new RenderImage();
		default:
			return null;
		}
	}

}
